package com.blockchain.front.servlets.api.ticker;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.framework.service.ServiceSession;
import com.blockchain.front.service.trading.TradingManage;
import com.blockchain.front.servlets.api.AbstractTickerServlet;
import com.blockchain.front.util.JsonUtil;

/**
 * 机器人API接口</br>
 * 获取所有币种行情</br>
 * 修改时间：2017年7月24日16:01:35</br>
 */
@WebServlet(value = { "/api/ticker/getAllCoin" })
public class GetAllCoin extends AbstractTickerServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processPost(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		TradingManage tradingManage = serviceSession.getService(TradingManage.class);
		ResultMessage msg = new ResultMessage();
		msg.data = tradingManage.getAllCoin(null);
		response.getWriter().write(JsonUtil.GsonString(msg));
	}

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}
}
